/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.business.account.facade.order.trans.fee;

import info.peigen.hotpot.business.account.facade.enums.AccountFeeAction;
import info.peigen.hotpot.common.core.lang.money.Money;
import jakarta.validation.constraints.NotEmpty;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import static info.peigen.hotpot.business.account.facade.enums.AccountFeeAction.Charge;
import static info.peigen.hotpot.business.account.facade.enums.AccountFeeAction.Free;

/**
 * <b>(FeeOrderInfo)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/8/21
 */
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
public class FeeOrderInfo {
    /** 被收费的账户 */
    @NotEmpty
    String           payerAccountId;
    /** 收费账户 */
    @NotEmpty
    String           payeeAccountId;
    /** 收费金额 */
    @Builder.Default
    Money            feeAmount = Money.zero();
    /** 收费行为 */
    @Builder.Default
    AccountFeeAction action    = Charge;
    /** 收费产品码 */
    String feeProductCode;
    /** memo */
    String memo;

    public static FeeOrderInfo freeOrderInfo(String payerAccountId, String payeeAccountId) {
        return FeeOrderInfo.builder().payerAccountId(payerAccountId).payeeAccountId(payeeAccountId)
                .action(Free)
                .build();
    }
}
